package com.starwish.starwishblog.mapper;

import com.starwish.starwishblog.entity.Manager;
import com.starwish.starwishblog.vo.ManagerLoginVo;
import com.starwish.starwishblog.vo.ManagerOperationVo;
import com.starwish.starwishblog.vo.ManagerVo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface ManagerMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Manager record);

    Manager selectByPrimaryKey(Integer id);

    List<Manager> selectAll();

    int updateByPrimaryKey(Manager record);


    @Select("select * from t_manager where admin_name = #{value}")
    Manager selectManagerByName(String name);

    List<ManagerVo> selectManagerVoByCons(String name);

    @Delete("delete from t_manager_role where manager_id = #{id}")
    int deleteRolesByMid(Integer id);

    int insertRolesToManager(@Param("mid") Integer id,
                             @Param("rids") List<Long> roleIds);

    int update(ManagerVo managerVo);

    int insertManager(ManagerVo managerVo);

    @Update("update t_manager set locked = #{status} where id = #{id}")
    int updateLocked(@Param("id") Long id,@Param("status") Integer status);


    int insertManagerLogin(ManagerLoginVo managerLoginVo);

    int insertManagerOperation(ManagerOperationVo operationVo);
}